<?php

namespace App\Transformers\Teacher;

use App\Libs\Tools\UploadTools;
use League\Fractal\TransformerAbstract;
use App\Models\Teacher\Certificate;

class CertificateTransformer extends TransformerAbstract
{

    public function transform(Certificate $model)
    {
        return [
            'id'         => (int) $model->id,
            'teacher_id' =>$model->teacher_id,
            'acquire_date'=>$model->acquire_date,
            'sponsor'=>$model->sponsor,
            'title'=>$model->title,
            'awards_name'=>$model->awards_name,
            'score'=>$model->score,
            'electron_attachment'=>UploadTools::getFileUrl($model->electron_attachment),
            'created_user'=>$model->created_user,
            'updated_user'=>$model->updated_user,
            'created_at' => $model->created_at->format('Y-m-d H:i:s'),
        ];
    }
}
